import sys
import uvicorn

from app.settings.config import DEBUG
from main import app

if __name__ == '__main__':
    port = 8001
    host = "0.0.0.0"
    if len(sys.argv) != 1:
        for argv in sys.argv[1:]:
            if argv[:6] == "--port":
                port = int(argv.rsplit("=")[1])
            elif argv[:6] == "--host":
                host = argv.rsplit("=")[1]
    uvicorn.run(app, debug=DEBUG, port=port, host=host)
